package cn.hicard.risk.dao.sys.impl;

import org.springframework.stereotype.Repository;

import cn.hicard.core.Page;
import cn.hicard.core.PageResult;
import cn.hicard.core.Where;
import cn.hicard.risk.dao.BaseDao;
import cn.hicard.risk.dao.sys.SysLogDao;
import cn.hicard.risk.entity.SysOperateLog;

@Repository
public class SysLogDaoImpl extends BaseDao<SysOperateLog> implements SysLogDao {

	@Override
	public void save(SysOperateLog log) throws Exception{
		super.save(log);
	}

	@Override
	public PageResult<SysOperateLog> search(Where where, Page page)
			throws Exception {
		String listHql = "FROM SysOperateLog WHERE 1=1 " + where.queryString();
		String countHql = "SELECT COUNT(*) FROM SysOperateLog WHERE 1=1 " + where.queryString();
		PageResult<SysOperateLog> pr = new PageResult<SysOperateLog>();
		pr.setDataList(super.findByHqlPage(listHql, page, where.getParams()));
		pr.setResultCount(super.findCountByHql(countHql, where.getParams()));
		return pr;
	}
	
}
